home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
FNTPAK32.ZIP
/
BASIC.EXE
/
DEMOFNT1.BAS
< prev
next >
Wrap
BASIC Source File
|
1995-08-16
|
8KB
|
231 lines
DEFINT A-Z
'$INCLUDE: 'Font_Pak.Inc' '... For QB/PDS/VB-DOS
'======================================================== PowerBasic Users
''$INCLUDE "Font_Pak.Inc" '... PB users, UN-REM these lines
''$Link "Hollow9.Obj" '... ALL users
''$Link "Script1.Obj" '... Examples of "callable" fonts
''$Link "Frazzl16.Obj"
''$Link "FontPakP.OBJ" '... SHAREWARE users
''$Link "Video.OBJ" '... REGISTERED users
''$Link "Fonts.OBJ" '... REGISTERED users
'======================================================== PowerBasic Users
'============================================================ DemoFnt1.Bas
'
' A Font Pak Demonstration Copyright 1991-1994 Rob W. Smetana
'
' Demonstrates how to: - CALL fonts to load them (e.g., Call OldEng(Block) ).
' - Use rsWhichFonts to "activate" 1 -or- 2 fonts.
' - Use color intensity to select which font(s) appear.
'
' Requires: - EGA/VGA, we'll check below
'
' - Font_Pak.LIB (QB/PDS/VB-DOS) -or- Font_Pak.PBU (PowerBasic)
'
'============================================================ DemoFnt1.Bas
DECLARE SUB Demo.CALLing.Fonts ()
DECLARE SUB Script1 (BYVAL Block) '...Declare "callable fonts"
DECLARE SUB Hollow9 (BYVAL Block) ' NOTE: Pass BlockNumber BYVAL!!!
DECLARE SUB Frazzle (BYVAL Block)
'============================================================
'GetMonitor returns an integer (0 - 8) indicating the type of
'monitor in use. If two monitors are being used, GetMonitor
'returns the type of the primary monitor.
'
' 0 = None (no monitor) 1 = Monochrome
' 3 = Color (CGA) 4 = EGA (or MultiSync)
' 7 = VGA Monochrome 8 = VGA Color (or MultiSync)
'============================================================
COLOR 7, 1: CLS
CALL fpInitialize '=== SHAREWARE versions ONLY
SCREEN , 0 '...this helps ensure QB/QBX/VBDOS restore
' the default font (note the comma)
SELECT CASE GetMonitor
CASE 4, 7, 8 '...we're okay; it's EGA, VGA or compatible
CASE ELSE
CLS
PRINT "Sorry, this demo requires an EGA or VGA monitor."
END
END SELECT
CALL Demo.CALLing.Fonts
PRINT
PRINT "NOTE: Here we CALLed fonts that we converted to OBJ files (using Font2Asm)."
PRINT
PRINT " Loading fonts from DISK is almost as easy. We'd just:"
PRINT
PRINT " Declare Function LoadFontFile (FontFile$, Block)"
PRINT
PRINT " ErrorCode = LoadFontFile (Font1$, Block1)"
PRINT
PRINT
PRINT " If ErrorCode = 0 then '...if no error, select it"
PRINT " Call rsWhichFonts(Block1, Block1)"
PRINT " Else ... '...otherwise handle error"
PRINT " End If"
PRINT : PRINT
END
'
SUB Demo.CALLing.Fonts
PressAKey$ = "Press a key to continue . . ."
WhichFont$ = " " '=== to describe font(s)
'=== Pre-load blocks 1-3. If we DON'T do this, the line-draw
' characters will VANISH when we switch to blocks 1-3 exclusively.
' To see what I mean, comment out the 3 Call rsLoadDefault... lines,
' and add a SCREEN 9: SCREEN 0 here.
'=== If VGA load 8x16; otherwise load 8x14.
IF GetMonitor > 6 THEN FontSize = 16 ELSE FontSize = 14
'=== Try 8x8 and notice the GAPS between vertical lines.
'FontSize = 8
CALL rsLoadDefault(FontSize, 1) '...Once you load these blocks, they'll
CALL rsLoadDefault(FontSize, 2) ' stay loaded (unless you switch screen modes).
CALL rsLoadDefault(FontSize, 3)
'=== 1st, load three fonts into blocks 1 - 3
Script = 1 '...We'll load fonts into blocks 1-3.
Hollow = 2 ' The leaves the default font intact
FrazzleLin = 3 ' and available in block 0.
CALL Script1(Script) '...Notice nothing will happen by just
CALL Hollow9(Hollow) ' loading fonts (unless we re-map block 0).
CALL Frazzle(FrazzleLin) '...Below we'll CALL rsWhichFonts to
' "activate" 1 or 2 fonts.
COLOR 7, 1
'=========================================== Part 1: Show 1 font at a time
CLS
PRINT TAB(37); "Font Demo":
PRINT " Here's how easy it is to change fonts by CALLing [font name]."
'========================
LOCATE 4, 1
GOSUB DisplayDemo '===== 1st, display some text
LSET WhichFont$ = "This is your normal text font."
GOSUB PauseForKey
'===== 2nd, "activate" fonts
LSET WhichFont$ = "Normal -- with frazzled lines!"
CALL rsWhichFonts(FrazzleLin, FrazzleLin) '===== "Activate" Frazzle exclusively
GOSUB PauseForKey
LSET WhichFont$ = "CALL Hollow9 -- our Hollow Font."
CALL rsWhichFonts(Hollow, Hollow) '===== "Activate" Hollow exclusively
GOSUB PauseForKey
LSET WhichFont$ = "CALL SCRIPT1 -- our Script Font."
CALL rsWhichFonts(Script, Script) '===== "Activate" Script exclusively
GOSUB PauseForKey
'============================================ Part 2: Show 2 fonts at once
CLS
GOSUB DisplayDemo '===== 1st, display some text
PRINT
COLOR 0, 7
PRINT " This shows 2 fonts at once. Look at the code later to see how simple this is. "
PRINT
COLOR 11, 1
GOSUB DisplayDemo '===== 2nd, display some in bright
CALL rsWhichFonts(0, 0) '===== "activate" the default font
LSET WhichFont$ = "The default text font again."
GOSUB PauseForKey
LSET WhichFont$ = "Frazzle and Script"
CALL rsWhichFonts(FrazzleLin, Script) '===== "Activate" two fonts
GOSUB PauseForKey
LSET WhichFont$ = "Hollow and Frazzle"
CALL rsWhichFonts(Hollow, FrazzleLin)
GOSUB PauseForKey
LSET WhichFont$ = "Script and Hollow"
CALL rsWhichFonts(Script, Hollow)
GOSUB PauseForKey
LSET WhichFont$ = "The same, but with a palette change."
CALL DefaultPalette(2) '===== 2 = bright, 1 = low intensity
GOSUB PauseForKey
CALL rsWhichFonts(0, 0) '===== back to the default
CALL DefaultPalette(0) ' palette also
CLS
EXIT SUB
'========================
PauseForKey:
'========================
LOCATE 25, 5: PRINT WhichFont$;
LOCATE , 47: PRINT PressAKey$;
d$ = INPUT$(1)
RETURN
'========================
DisplayDemo:
'========================
d$ = " " '=== used to easily adjust shift printing left/right
PRINT d$; "┌─░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓ FONT DEMO ▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░─┐"
PRINT d$; "│ We are NOT displaying different screens! We'll display this once. Then, │"
PRINT d$; "│ as we ACTIVATE different fonts, the appearance changes. Fonts remain in │"
PRINT d$; "│ effect until we activate another or until a program changes screen modes.│"
PRINT d$; "│ ┌───┬─────────┐ ╔═══╦═════════╗ ╒═══╤═════════╕ ╓───╥────────╖ │"
PRINT d$; "│ │ ├─────────┼─ ║ ╠═════════╬═ │ ╞═════════╪═ ║ ╟────────╫─ │
PRINT d$; "│ └───┴─────────┘ ╚═══╩═════════╝ ╘═══╧═════════╛ ╙───╨────────╜ │"
PRINT d$; "│ ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz │"
PRINT d$; "│ 1234567890 -=!@#$%^&*()_+[] {};'<>?,./\|~`ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥ │"
PRINT d$; "└──────────────────────────────────────────────────────────────────────────┘"
RETURN
END SUB